#pragma once

#include "./normal_algo.h"
#include "opencv2/opencv.hpp"
#include <opencv2\highgui.hpp>
#include <opencv2\imgproc.hpp>
// #include "infer_seg_v2_o.h"
#include "openvino/openvino.hpp"

#include "../txr_algo_dlm_seg/txr_algo_dlm_seg_define.h"

namespace txr_algo_dlm_seg
{ 
class InferSegV2_o 
{
	#define DATS_EXTENSION ".oseg2"

public:
	InferSegV2_o();
	~InferSegV2_o();
	bool Init(int gpu_id, const char* dats_path) ;
	void Detect(st_detect_unit* p_unit, int num);
protected:
private:
	bool LoadEngine(std::vector<char> v_engine_data) ;
	std::tuple<std::vector<std::vector<float>>, int, int> prepareImage(st_detect_unit* p_units, int num, std::vector<cv::Mat>& v_imgs);
	void postProcess(st_detect_unit* p_unit,int size, float* output, const int& final_resize_h, const int& final_resize_w);

private:
	int m_out_size =  0 ;

	st_encrypt_info_ovino m_info;                                    // 加密信息

	ov::Core core;
	ov::CompiledModel compiled_model;
	std::vector<ov::InferRequest> infer_requests;
	std::vector<ov::Tensor> m_v_tensors;

	std::vector<float> m_v_out_buf;                          // 输出缓冲区
	std::vector<int> m_v_predict_shape;                      // 预测形状
	// std::vector<st_cuda_resize_dev_space> _v_resize_space;
};

}//txr_algo_dlm_seg